<style lang='less' >
  .creditorBtnsBox{
    #btnsBox{
      text-align: left;
      button{
        background-color: #63c5ce;
        color:#fff;
        font-size: 14px;
        padding:3px 10px;
        border-radius: 3px;
      }
      .fontColorGary{
        background-color: #bbb;
      }

    }
  }
</style>

<template>
  <div class="creditorBtnsBox">
    <div id='btnsBox'>
      <button v-if='btnControl && btnControl.import' :class='{fontColorGary: !canImport}' @click='clickBtn("Import")'>进行匹配</button>
      <button v-if='btnControl && btnControl.check' :class='{fontColorGary: !canCheck}' @click='clickBtn("Check")'>查看名单</button>
    </div>

    <import-dialog-box
      v-if='dialogShow'
      :propViewType='propViewType'
      :isVisible='dialogShow'
      :productCode='scope.row.productCode'
      :productId='scope.row.id'
      :productName='scope.row.productName'
      v-on:handleDialogVisible='handleDialogVisible'
      v-on:reloadPage='reloadPage'
    ></import-dialog-box>
  
  </div>
</template>

<script>
  import importDialogBox from './dialog/import'
  export default {
    props:[ 'scope','btnControl'],
    components:{
      importDialogBox,
    },
    data(){
      return{
        dialogShow:false,
        propViewType:null,
      }
    },
    computed:{
      canImport(){
        // console.log('canImport', this.scope.row, this.scope.row.full, this.scope.row.match)
        let state = this.scope && this.scope.row && this.scope.row.full && !this.scope.row.match ? true : false;
        return state
      },
      canCheck(){
        // console.log('canImport', this.scope.row, this.scope.row.full, this.scope.row.match)
        return this.scope.row.match && this.scope.row.full
      }
    },
    methods:{
      reloadPage(){
        this.$emit('reloadTable')
      },
      clickBtn(classes){
        // console.log('clickBtn', classes, this['can'+classes])
        if(!this['can'+classes])return
        if(classes =='Check'){
          this.propViewType = 3
        }
        this.dialogShow = true
      },
      handleDialogVisible(){
        console.log('handleDialogVisible')
        this.dialogShow = !this.dialogShow;
        this.propViewType = null;

      },
      goPage(name){
        this.$router.push({
          name:name,
          query:{}
        })
      }
    },
    created(){
    },
    mounted(){
    },
  }
</script>